<?php
include 'lanewechat.php';
if( !empty( $_REQUEST ) && isset( $_REQUEST['openid'] ) ){
    //\LaneWeChat\Core\Common::cardLoss( $_REQUEST['openid'] , $_REQUEST['type'] );
}
$info = array();
$info = \LaneWeChat\Core\Common::getCurrentCardInfo( $_REQUEST['openid'] );
?>
<!DOCTYPE html>
<html>
<head>
    <title>鹏企科技</title>
    <meta name="keywords" content="鹏企科技">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1,initial-scale=1.0, maximum-scale=1.0,user-scalable=0">
    <meta name="renderer" content="webkit">
    <link rel=Stylesheet type="text/css" href="css/common.css">
    <link rel=Stylesheet type="text/css" href="css/style.css">
</head>

<body>


<div class="container">

    <div class="header" onclick="history.go(-1)"><img src="images/arrow.png">用户中心</div>

    <div class="headerimg" >
        <p><img src="<?=$_REQUEST['headimgurl']?>" onerror="this.src='images/headerimg.jpg'" id="changeimg"><span><img src="images/female.jpg"></span></p>
        <font><?=$_REQUEST['nickname']?></font>
    </div>

    <div class="container2 count">
        <p>账户余额（元）<font><?=$info['SumCash']/100?></font></p>
        <p>账户余次（次）<font>10</font></p>
    </div>

    <div class="uc-list">
        <a href="qrcode.php?openid=<?=$_REQUEST['openid']?>">扫码消费(线下领卡)<img src="images/arrow-list.png"></a>
        <a href="profile.php?openid=<?=$_REQUEST['openid']?>">个人信息<img src="images/arrow-list.png"></a>
        <a href="/app/index.php?i=2&c=entry&do=orderdetail&m=weisrc_dish&otherurl=recharge">充值<img src="images/arrow-list.png"></a>
        <a href="rechargeList.php?id=Rpt_Vip_Log2&openid=<?=$_REQUEST['openid']?>">充值记录<img src="images/arrow-list.png"></a>
        <a href="reportDetail.php?id=Rpt_Vip_Log&openid=<?=$_REQUEST['openid']?>">消费记录<img src="images/arrow-list.png"></a>

        <a href="diet.html">健康饮食<img src="images/arrow-list.png"></a>
        <a href="health.html">健康体检<img src="images/arrow-list.png"></a>
        <a href="javascript:void(0)" id="cardloss">挂失补卡<img src="images/arrow-list.png"></a>
        <a href="javascript:void(0)" id="cardloss1">退卡<img src="images/arrow-list.png"></a>
<!--        <a href="#">修改密码<img src="images/arrow-list.png"></a>-->
    </div>


    <div class="footer"><img src="images/logo.png">本服务由上海鹏企自动化科技有限公司提供</div>

</div>





<!--卡挂失 弹出框 开始--->

<div class="pop-cardloss" id="imgBox2">
    <a href="javascript:void(0)" id="btn-close"><img src="images/close.png"></a>
    <p>之前的卡片<br>
        已退掉!</p>
    <font>可以凭借卡片前去退钱。</font>
</div>

<!--卡挂失 弹出框 开始--->

<div class="pop-cardloss" id="imgBox1">
    <a href="javascript:void(0)" id="btn-close3"><img src="images/close.png"></a>
    <p>之前的卡片<br>
        已挂失!</p>
    <font>请尽快使用微信二微码前去领取新卡。</font>
</div>

<!--卡挂失  弹出框  结束--->


<!--更换头像 弹出框 开始--->

<div class="pop-changeimg" id="imgBox2" style="display: none">
    <a href="javascript:void(0)" id="btn-close2"><img src="images/close.png"></a>
    <input name="" type="button" value="从相册选取一张">
</div>

<!--卡挂失  弹出框d  结束--->

<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
<script src="js/easydialog.min.js"></script>
<script type="text/javascript">
    var openid = '<?=$_REQUEST['openid']?>',flag=0;
    //卡挂失
    document.getElementById('cardloss').onclick = function(){
        if( !confirm('确认要挂失吗？') ){
            return false;
        }
        if( flag == 1 ) return false;
        flag = 1;
        $.ajax({
            url:'query.php',
            type:'post',
            data:{
                openid:openid,
                type:'Y'
            },
            error:function(d){
            },
            dataType:'json'
        }).done(function(data){
            flag = 0;
            if(data.error==0){
                easyDialog.open({
                    container : 'imgBox1',
                    <!--autoClose : 2000,-->
                    fixed : false
                });
            }
            else{
                alert('挂失失败！');
            }

        });

    };

 //卡挂失
    document.getElementById('cardloss1').onclick = function(){
        if( !confirm('确认要退卡吗？退卡后卡片将不能刷，可凭借卡片前去退钱') ){
            return false;
        }
        if( flag == 1 ) return false;
        flag = 1;
        $.ajax({
            url:'query.php',
            type:'post',
            data:{
                openid:openid,
                type:'N'
            },
            error:function(d){
            },
            dataType:'json'
        }).done(function(data){
            flag = 0;
            if(data.error==0){
                easyDialog.open({
                    container : 'imgBox2',
                    <!--autoClose : 2000,-->
                    fixed : false
                });
            }
            else{
                alert('退卡失败！');
            }

        });

    };
    document.getElementById('btn-close').onclick = function(){
        easyDialog.close({
            autoClose : 2000,
            fixed : false
        });
        window.location.reload();
    };
    //更换头像
    document.getElementById('changeimg').onclick = function(){
        easyDialog.open({
            container : 'imgBox2',
            <!--autoClose : 2000,-->
            fixed : false
        });
    };


    document.getElementById('btn-close2').onclick = function(){
        easyDialog.close({
            autoClose : 2000,
            fixed : false
        });
    };


    document.getElementById('btn-close3').onclick = function(){
        easyDialog.close({
            autoClose : 2000,
            fixed : false
        });
		 window.location.reload();
    };

</script>
</body>
</html>